package com.qkjia.day02;

import com.qkjia.day01.SleepUtils;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicStampedReference;

public class Test08_CAS03 {
    public static AtomicInteger count = new AtomicInteger(0);
    public static int a = 0;
    public static AtomicStampedReference count1 = new AtomicStampedReference(0,1);
    public static void main(String[] args) {
        for (int i = 0; i < 2; i++) {
            new Thread(() -> {
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                for (int j = 0; j < 100; j++) {
                    count.incrementAndGet();
                    a++;
                }
            }).start();
        }
        SleepUtils.second(3);
        System.out.println(count);
        System.out.println(a);
    }
}
